package com.steellee.leeexcel.msg;

import java.io.Serializable;

/**
 * 返回结果定义集合
 *
 * @author steellee
 * @date 2023-02-17
 */
public class JSONMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    private static String SUCCESS_CODE = "000000";
    // 错误码
    public String responseCode;
    // 错误信息
    public String responseMsg;
    // 返回结果对象
    public Object result;

    /**
     * 构造函数
     */
    public JSONMessage() {
    }

    /**
     * 构造函数
     */
    public JSONMessage(String responseCode, String responseMsg, Object result) {
        super();
        this.responseCode = responseCode;
        this.responseMsg = responseMsg;
        this.result = result;
    }

    /**
     * 构造函数
     */
    public JSONMessage(String responseCode, String responseMsg) {
        super();
        this.responseCode = responseCode;
        this.responseMsg = responseMsg;
    }

    /**
     * 构造函数
     */
    public JSONMessage(String responseCode, Object result) {
        super();
        this.responseCode = responseCode;
        this.result = result;
    }


    /**
     * 返回成功的方法
     */
    public static JSONMessage success(String responseCode, String responseMsg, Object result) {
        return new JSONMessage(responseCode, responseMsg, result);
    }

    /**
     * 返回成功的方法
     */
    public static JSONMessage success(String responseCode, String responseMsg) {
        return new JSONMessage(responseCode, responseMsg);
    }

    /**
     * 返回成功的方法
     */
    public static JSONMessage success() {
        return new JSONMessage(SUCCESS_CODE, null);
    }

    /**
     * 返回成功的方法
     */
    public static JSONMessage success(String responseMsg) {
        return new JSONMessage(SUCCESS_CODE, responseMsg);
    }

    /**
     * 返回成功的方法
     */
    public static JSONMessage success(Object result) {
        return new JSONMessage(SUCCESS_CODE, result);
    }

    /**
     * 返回成功的方法
     */

    public static JSONMessage success(String responseCode, Object result) {
        return new JSONMessage(responseCode, result);
    }

    /**
     * 返回错误的方法
     */
    public static JSONMessage error(String responseCode, String responseMsg) {
        return new JSONMessage(responseCode, responseMsg);
    }
}